package moxl.parser.assemblers.openelement;

import java.util.EnumMap;
import java.util.Map;

import moxl.parser.assemblers.AbstractAssemblerContext;
import moxl.tokenizer.Token;
import moxl.tokenizer.TokenStream;

public class OpenElementAssemblerContext extends AbstractAssemblerContext<OpenElementAssemblerState>
{
	private final Map<OpenElementBookmark, Token> bookmarkedTokens = new EnumMap<OpenElementBookmark, Token>(OpenElementBookmark.class);

	public OpenElementAssemblerContext(TokenStream tstream)
	{
		super(tstream, OpenElementAssemblerState.START);
	}

	@Override
	public boolean isNotFinished()
	{
		return getState() != OpenElementAssemblerState.END;
	}

	public void bookmarkToken(OpenElementBookmark bookmark)
	{
		bookmarkedTokens.put(bookmark, getToken());
	}

	public Token getBookmarkedToken(OpenElementBookmark bookmark)
	{
		return bookmarkedTokens.get(bookmark);
	}

}
